<template>
  <div >
    <el-form :model="ruleForm"  ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户名" prop="checkPass">
        <el-col :span="6"><el-input type="text" v-model="ruleForm.username" autocomplete="off" ></el-input></el-col>
      </el-form-item>
      <el-form-item label="密码" prop="pass">
        <el-col :span="6"><el-input type="password" v-model="ruleForm.password" autocomplete="off"></el-input></el-col>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {
    data(){
      return{
        ruleForm:{
          username:"",
          password:""
        }
      }
    },
    methods:{
      submitForm(){
        let params = new URLSearchParams();
                  params.append("username", this.ruleForm.username);
                  params.append("password", this.ruleForm.password);
        this.$http.post("issueUser/login",params).then(resp=>{
          if(resp.data.code==200){
            localStorage.setItem("com.woniu.loginUser",JSON.stringify(resp.data.data))
            this.$router.push("/manager")
          }else{
            this.$message.error(resp.data.msg)
          }
        })
      }
    }

  }
</script>

<style>
</style>
